﻿// This code is released under the BSD license.
namespace PugLib.UnitTest
{
    #region

    using Extensions.Collections;
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    #endregion

    /// <summary>
    ///This is a test class for StringFormatterTest and is intended
    ///to contain all StringFormatterTest Unit Tests
    ///</summary>
    [TestClass]
    public class StringFormatterTest
    {
        /// <summary>
        ///A test for FormatData
        ///</summary>
        public void FormatDataTestHelper()
        {
            string separator = "|";
            string[] data = new[] { "a", "b", "c" };
            string expected = @"a|b|c";
            string actual = StringFormatter.FormatData(separator, data);
            Assert.AreEqual(expected, actual);

            separator = null;
            actual = StringFormatter.FormatData(separator, data);
            Assert.AreEqual(expected, actual);

            separator = string.Empty;
            actual = StringFormatter.FormatData(separator, data);
            Assert.AreEqual(expected, actual);

            separator = "-=-";
            expected = @"a-=-b-=-c";
            actual = StringFormatter.FormatData(separator, data);
            Assert.AreEqual(expected, actual);

            expected = @"a, b, c";
            actual = data.EnumerableToString();
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void FormatDataTest()
        {
            FormatDataTestHelper();
        }
    }
}